﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MN.Framework.Common;

namespace MN.Framework.MetaData
{
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public class AssociatedWithAttribute : Attribute
    {
        AssociationType _AssociationType;
        string _ForiengKeyField;
        NavigationProperty _NavigationProperty;
        Type _ReferencedEntityType;
        public AssociatedWithAttribute(Type referencedEntityType, string foreignKeyField, AssociationType associationType)
        {
            _ReferencedEntityType = referencedEntityType;
            _ForiengKeyField = foreignKeyField;
            _AssociationType = associationType;
        }

        public AssociationType AssociationType { get { return _AssociationType; } }
        public string ForiengKeyField { get { return _ForiengKeyField; } }
        public NavigationProperty NavigationProperty
        {
            get { return _NavigationProperty; }
            set
            {
                _NavigationProperty = value;
            }
        }
        public Type ReferencedEntityType
        {
            get
            {
                return _ReferencedEntityType;
            }
        }
    }
}
